<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>GT pro钱包</title>
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
		<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
		<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
		<link rel="stylesheet" href="dist/css/skins/skin-blue.min.css">
		<link rel="stylesheet" href="css/style.css">
		<link rel="stylesheet" href="css/card.css">
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

		<link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css">
		<link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
		<style>
			.hint {
				position: relative;
				margin: 20px 20px;
				padding-left: 30px;
				background-color: #FFFEEE;
				border: 1px solid #999;
				border-left: none;
				border-right: none;
			}
			
			.hint i {
				position: absolute;
				left: 0;
				width: 30px;
			}
			
			.hint i img {
				width: 20px;
				height: 20px;
				margin: 5px;
			}
			
			.hint span {
				line-height: 30px;
				font-size: 14px;
			}
			
			.report_points {
				margin: 20px 20px;
				font-size: 14px;
			}
			
			.report_points span {
				display: inline-block;
				float: left;
				line-height: 40px;
			}
			
			.report_points input {
				display: inline-block;
				float: left;
				margin: 0;
				font-size: 35px;
				border: 0px solid #fff;
				background-color: #fff;
				width: 58px;
				text-align: right;
			}
			
			.report_points i {
				display: inline-block;
				float: left;
				height: 40px;
			}
			
			.report_points i img {
				width: 20px;
				height: 20px;
				cursor: pointer;
				margin: 10px;
			}
			
			.report_menu {
				font-size: 0;
				margin-left: 20px;
			}
			
			.report_menu li {
				display: inline-block;
				width: 130px;
				line-height: 40px;
				text-align: center;
				font-size: 14px;
				background-color: #fff;
				border: 1px solid #ddd;
				border-right: none;
				cursor: pointer;
			}
			
			.report_menu li:last-child {
				border-right: 1px solid #eee;
			}
			
			.report_menu li.on {
				background-color: #00BFFF;
				color: #fff;
				border-color: #00BFFF;
			}
			
			.jishen_table {
				display: none;
			}
			
			.jishen_table.on {
				display: block;
			}
			
			.table_xiugai {
				width: 14px;
				height: 14px;
			}
			
			table input {
				width: 25px;
				border: 0px solid #ccc;
				background-color: #fff;
				color: #000;
				float: left;
			}
			
			table i {
				float: left;
			}
			
			.reget {
				margin-right: 20px;
				padding: 0 10px;
				line-height: 40px;
				color: #fff;
				background-color: #5db75d;
				border: 1px solid #5db75d;
				border-radius: 5px;
			}
		</style>
	</head>

	<body class="hold-transition skin-blue sidebar-mini">
		<div class="wrapper">
			<div class="content-wrapper">
				<section class="content-header">
					<ol class="breadcrumb">
						<li>
							<a href="#"><i class="fa fa-dashboard"></i>系统设置</a>
						</li>
						<li class="active">机审规则设置</li>
					</ol>
				</section>
				<section class="content">
					<div class="box">
						<div class="box-header with-border">
							机审规则设置
						</div>
						<div class="box-body">
							<div class="buyu_search_group">
								
							</div>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<!-- /.box-header -->
								<div class="box-body">
									<div class="hint">
										<i><img src="img/system_dengpao.png" alt="" /></i>
										<span>机审开启后，系统将自动根据用户资信报告中的权重分进行决策，当用户总得分少于决策设置分时，系统自动过滤掉用户；当用户总得分在决策分之上时，该用户进入人工审核程序，当用户命中该风险检测项时，将从100分决策分中扣除该项设置的权重分。</span>
									</div>
									

									<div class="row" style="margin-bottom:10px;">
										<div class="col-xs-12">
											<div class="report_points clearfix"><span>决策分设置：</span>
												<input disabled="disabled" id="report_points_input" style="height:40px;">
												<i><img src="img/system_xiugai.png" alt="" id="report_points_xiugai"/></i>
											</div>
										</div>
										<div class="col-xs-3">
											<div class="report_points">
							                <label style="font-weight: normal;">接收推送的用户id</label>
							                <textarea class="form-control" rows="3" placeholder="多个用,分割" id="machine_push_users"></textarea>
							                </div>
										</div>
										<div class="col-xs-12">
											<button type="button" class="btn bg-primary margin" onclick="UpdateMachineScore()"><i class="fa fa-pencil" ></i>&nbsp;修改</button>
										</div>
									</div>
									<div class="tabCon">
										<div class="jishen_table on">
											<table id="example" class="display nowrap table table-bordered table-striped" style="width:100%;">
												<thead>
													<tr>
														<th>名称</th>
														<th>机审范围</th>
														<th>权重分</th>
													</tr>
												</thead>
												<tbody></tbody>
											</table>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</section>
			</div>
		</div>
		<script src="bower_components/jquery/dist/jquery.min.js"></script>
		<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
		<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>

		<script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
		<script src="bower_components/moment/min/moment.min.js"></script>
		<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>

		<script src="dist/js/adminlte.min.js"></script>
		<script src="js/argument.js"></script>
		<script src="js/fun.js"></script>
		<script src="js/buyu_fun.js"></script>
		<script src="js/nav.js"></script>
		<script src="js/pop.js"></script>
		<script src="js/getList.js"></script>
		<script type="text/javascript">
			$("#report_points_xiugai").click(function(){
				if(!$("#report_points_input").prop("disabled")){
					console.log(111);
				}
				$("#report_points_input").prop("disabled",false);
				$("#report_points_input").attr("now_value",$("#report_points_input").val());
				$("#report_points_input").focus()
			})
			
			$('#report_points_input').change(function(){
				$("#report_points_input").prop("disabled",true);
			})

			var table = $('#example').DataTable({
				'ordering': false,
				'lengthChange': false,
				'searching': false,
				'info': true,
				"processing": true,
				"serverSide": true,
				'scrollX': true,
				"ajax": {
					"type": 'post',
					"url": url + "Back_MachineRuleList",
					"contentType": "application/x-www-form-urlencoded",
					"headers": {
						"auth-token": localStorage.getItem("wallet_token")
					},
					"data": function(d) {
						var Json ={}// renderData(dataType);
						Json.page_num = d.start / 10 + 1;
						var data = {};
						data.data = JSON.stringify(Json);
						return data;
					},
					"dataFilter": function(data) {
						var datajson = eval('(' + data + ')');
						if(datajson.status == 1000||datajson.status == 102) {
							ToLogin(datajson)
							return false;
						} else if(datajson.status != 1) {
							alert(datajson.error);
							return false;
						}
						var json = {};
						$('#report_points_input').val(datajson.data.machine_score)
						$('#machine_push_users').val(datajson.data.machine_push_users)
						console.log(datajson.data.rule_list.length)
						if(datajson.data.rule_list.length == 0) {
							json.recordsTotal = 0;
							json.recordsFiltered = 0;
							json.data = [];
							return JSON.stringify(json);
						} else {
							json.recordsTotal = datajson.data.rule_list.length;
							json.recordsFiltered = datajson.data.rule_list.length;
							json.data = datajson.data.rule_list;
							return JSON.stringify(json);
						}
					}
				},
				"columns": [
					{
						data: 'name'
					},
					{
						data:null,render:function(data){
							var remark = data.remark;
							if(data.type == 1){
								var list = [];
								if(remark.indexOf('>')){
									list = remark.split(">");
									return "<div style='display: inline-block;'><span class='lfloat'>"+list[0] +'>&nbsp;'+"</span><input disabled='disabled' value="+ data.number+" key="+data.alias+" rule_id="+data.id+"><i class='table_xiugai_i'><img src='img/system_xiugai.png' alt='' class='table_xiugai'></i></div><span class='lfloat'>"+ list[1]+'</span>'
								}else if(remark.indexOf("<")){
									list = remark.split("<")
									return list[0] +"<"+"<div style='display: inline-block;'><input disabled='disabled' value="+ data.number+" key="+data.alias+" rule_id="+data.id+"><i class='table_xiugai_i'><img src='img/system_xiugai.png' alt='' class='table_xiugai'></i></div>"+ list[1]
								}
							}else{
								return remark
							}
							
							
							//return 
						}// 'remark'
					},
					{
						data:null,render:function(data){
							return "<div style='display: inline-block;'><input disabled='disabled' value="+ data.weight_num+" key="+data.alias+" rule_id="+data.id+"><i class='table_xiugai_i'><img src='img/system_xiugai.png' alt='' class='table_xiugai'></i></div>";
						} //'number'
					}
				]
			})
			
			
			$("#example").on("click",".table_xiugai_i",function(){
        		$(this).siblings("input").attr("now_value",$(this).siblings("input").val());
        		$(this).siblings("input").attr("disabled",false);
        		$(this).siblings("input").focus();
        	})
			
			$("#example").on("blur","input",function(){
        		$(this).prop("disabled",true);
        		var _this=$(this);
        		if(_this.attr("now_value")==_this.val()){
        			return false;
        		}
        		
        		var data = {};
        		var rule_id = _this.attr('rule_id');
        		
        		list = $("[rule_id = "+rule_id+"]");
        		//
        		if(list.length == 2){
        			data.number = list.eq(0).val();
        			data.weight_num = list.eq(1).val();
        		}else{
        			data.weight_num = list.eq(0).val();
        		}
        		data.rule_id = rule_id;
        		console.log(data);
				$.ajax({
					type: "post",
					url: url + "Back_UpdateMachineRule",
					'contentType': "application/x-www-form-urlencoded",
					"headers": {
						"auth-token": localStorage.getItem("wallet_token")
					},
					data: {
						data: JSON.stringify(data)
					},
					dataType: "json",
					success: function(res) {
						if(res.status == 1000||res.status == 102) {
							ToLogin(res)
							return false;
						} else if(res.status != 1) {
							alert(res.error);
							return false;
						}
						move('success','修改成功')
					}
				})
        	})
			
			//Back_UpdateMachineScore
			function UpdateMachineScore(){
				$.ajax({
					type: "post",
					url: url + "Back_UpdateMachineScore",
					'contentType': "application/x-www-form-urlencoded",
					"headers": {
						"auth-token": localStorage.getItem("wallet_token")
					},
					data: {
						data: JSON.stringify({
							machine_score:$("#report_points_input").val(),
							machine_push_users:$("#machine_push_users").val(),
						})
					},
					dataType: "json",
					success: function(res) {
						if(res.status == 1000||res.status == 102) {
							ToLogin(res)
							return false;
						} else if(res.status != 1) {
							alert(res.error);
							return false;
						}
						move('success','修改成功')
					}
				})
			}
			
		</script>
		
	</body>

</html>

<!--<!DOCTYPE html>
<html lang="zh-CN">

	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta name="renderer" content="webkit">
		<title></title>
		<link rel="stylesheet" type="text/css" href="js/theme/default/layer.css" />
		<link rel="stylesheet" type="text/css" href="css/eui.css?v=20190130" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery.slimscroll.js"></script>
		<script type="text/javascript" src="js/jquery.pagination.js"></script>
		<script type="text/javascript" src="js/layer.js"></script>
		
	</head>

	<body>
		<img src="images/loading.gif" id="loading" alt="" style="position: fixed;left: 50%;top: 50%;margin-top: -86px;margin-left: 40px;z-index: 100;" />
		<div class="header clearfix">
			<div class="lfloat logo"><img src="images/logo.png" /></div>
			<ul>
			</ul>
			<div class="user rfloat">
				<div class="name lfloat"><i><img src="images/photo.jpg" alt="" width="42" height="42"/></i><span>admin</span></div>
				<div class="operation">
					<ol>
						<li>
							<a href="account_chanPass.html">修改密码</a>
						</li>
						<li class="exit">退出登录</li>
					</ol>
				</div>
			</div>
		</div>
		<div class="sideNav">
			<ul id="flatdata"></ul>
		</div>
		<div class="position clearfix">
			<span>您当前所在位置：</span>
			<a href="javascript:void(0)">平台数据</a>&nbsp;&gt;&nbsp;
			<i>机审规则配置列表</i>
		</div>
		<div class="main">
			<div>
				<div class="tabCon_change">
					
				</div>
			</div>
		</div>
		<script type="text/javascript" src="js/eui.js?v=20190122"></script>
		<script type="text/javascript">
			$(".header ul li.system").addClass('on')
		</script>
		<script type="text/javascript" src="js/sideNav.js"></script>
		<script type="text/javascript">
			$('.sideNav').find('a[href="system_jishen.html"]').addClass('on')		
		</script>
		<script type="text/javascript">
			function rules_list(){
				$.ajax({
					type:"get",
					url:intUrl+"Statistics/audit_rules_list",
					async:true,
					data:{
						id:$(".header ul li.on").attr('code'),
						audit_id:localStorage.getItem('audit_id')
					},
					success:function(res){
						var resJSON = eval('('+res+')')
						console.log(resJSON);
						reLogin(resJSON.status)
						if(resJSON.status!=1){
							layer.alert(resJSON.error+'，请重新获取机审规则');
							$("#loading").hide()
							return false;
						}
						var data=resJSON.data;
						$(".report_points input").val(resJSON.audit_fraction);
						for(var i=0;i<data.length;i++){
							var str="";
							str="<tr audit_id="+data[i].audit_id+"><td>"+data[i].name+"</td><td>"+data[i].desc+"</td><td><div style='display: inline-block;'><input disabled='disabled' value="+ data[i].fraction+"><i class='table_xiugai_i'><img src='images/system_xiugai.png' alt='' class='table_xiugai'></i></div></td></tr>";
							$("#"+data[i].report_type+" table").append(str);
						}
						$("#loading").hide();
					}
				})
			}
			rules_list();
			$(".report_menu").on("click","li",function(){
				$(this).addClass("on").siblings("li").removeClass("on");
				$(".tabCon .jishen_table").eq($(this).index()).addClass("on").siblings().removeClass("on");
			})
			
			
			
			$('#report_points_input').blur(function () {
           	 	$.ajax({
           	 		type:"get",
					url:intUrl+"Statistics/behavior_score",
					async:true,
					data:{
						id:$(".header ul li.on").attr('code'),
						behavior_score:$("#report_points_input").val(),
						audit_id:localStorage.getItem('audit_id')
					},
					success:function(res){
						var resJSON = eval('('+res+')')
						console.log(resJSON);
						reLogin(resJSON.status)
						$("#report_points_input").attr("disabled",true);
						if(resJSON.status!=1){
							layer.alert(resJSON.error);
							$("#report_points_input").val($("#report_points_input").attr("now_value"));
							return false;
						}
						layer.alert(resJSON.error);
					}
           	 	})
        	});
        	
        	$(".jishen_table").on("click",".table_xiugai_i",function(){
        		$(this).siblings("input").attr("now_value",$(this).siblings("input").val());
        		$(this).siblings("input").attr("disabled",false);
        		$(this).siblings("input").focus();
        	})
        	
        	
        	
        	$("#reget").click(function(){
        		$("#loading").show();
        		$.ajax({
        			type:"post",
					url:intUrl+"Onekey/audit_rules",
					async:true,
					data:{
						audit_id:localStorage.getItem('audit_id')
					},
					success:function(res){
						var resJSON = eval('('+res+')')
						reLogin(resJSON.status)
						if(resJSON.status==1){
							layer.alert("操作成功",function(){
								location.reload()
							})
						}else{
							alert("获取失败")
						}
						$("#loading").hide();
        			}
        		})
        	})
		</script>
	</body>
	
</html>-->